<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="EditLibrary.aspx.vb" Inherits="pages_EditLibrary" title="Edit Library" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .DetailsView 
        {
        	float: left;
        }
        #EditLibraryLabels
        {
            font-family: Calibri;
            width: 200px;
            height: 100px;
            float: left;
            text-align: right;
        }
        #EditLibraryBoxes
        {
            font-family: Calibri;
            width: 400px;
            height: 100px;
            float: left;
            text-align: left;
            padding-left: 15px;
        }
        #label
        {
            height: 23px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        Add/Edit Book or User:<br /><br /><br />
        <asp:DetailsView class="DetailsView" ID="BookDetailsView" runat="server" AllowPaging="True" 
            AutoGenerateRows="False" DataKeyNames="book_ID" DataSourceID="SqlDataSource1" 
            Height="50px" Width="310px" CellPadding="4" ForeColor="#333333" 
            GridLines="None">
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
            <RowStyle BackColor="#EFF3FB" />
            <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <Fields>
                <asp:BoundField DataField="book_ID" HeaderText="book_ID" ReadOnly="True" 
                    SortExpression="book_ID" />
                <asp:BoundField DataField="ISBN" HeaderText="ISBN" SortExpression="ISBN" />
                <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                <asp:BoundField DataField="author_Name" HeaderText="author_Name" 
                    SortExpression="author_Name" />
                <asp:BoundField DataField="copy_No" HeaderText="copy_No" 
                    SortExpression="copy_No" />
                <asp:BoundField DataField="checkOutStatus" HeaderText="checkOutStatus" 
                    SortExpression="checkOutStatus" />
                <asp:BoundField DataField="reserveStatus" HeaderText="reserveStatus" 
                    SortExpression="reserveStatus" />
                <asp:BoundField DataField="reserveFrequency" HeaderText="reserveFrequency" 
                    SortExpression="reserveFrequency" />
                <asp:BoundField DataField="chekcOutFrequency" HeaderText="chekcOutFrequency" 
                    SortExpression="chekcOutFrequency" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                    ShowInsertButton="True" />
            </Fields>
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <AlternatingRowStyle BackColor="White" />
        </asp:DetailsView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:mis431libraryConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:mis431libraryConnectionString.ProviderName %>" 
            
            SelectCommand="SELECT [book_ID], [ISBN], [Title], [author_Name], [copy_No], [checkOutStatus], [reserveStatus], [reserveFrequency], [chekcOutFrequency] FROM [Books]" 
            ConflictDetection="CompareAllValues" 
            DeleteCommand="DELETE FROM [Books] WHERE (([book_ID] = ?) OR ([book_ID] IS NULL)) AND (([ISBN] = ?) OR ([ISBN] IS NULL)) AND (([Title] = ?) OR ([Title] IS NULL)) AND (([author_Name] = ?) OR ([author_Name] IS NULL)) AND (([copy_No] = ?) OR ([copy_No] IS NULL)) AND (([checkOutStatus] = ?) OR ([checkOutStatus] IS NULL)) AND (([reserveStatus] = ?) OR ([reserveStatus] IS NULL)) AND (([reserveFrequency] = ?) OR ([reserveFrequency] IS NULL)) AND (([chekcOutFrequency] = ?) OR ([chekcOutFrequency] IS NULL))" 
            InsertCommand="INSERT INTO [Books] ([book_ID], [ISBN], [Title], [author_Name], [copy_No], [checkOutStatus], [reserveStatus], [reserveFrequency], [chekcOutFrequency]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)" 
            OldValuesParameterFormatString="original_{0}" 
            
            UpdateCommand="UPDATE [Books] SET [ISBN] = ?, [Title] = ?, [author_Name] = ?, [copy_No] = ?, [checkOutStatus] = ?, [reserveStatus] = ?, [reserveFrequency] = ?, [chekcOutFrequency] = ? WHERE (([book_ID] = ?) OR ([book_ID] IS NULL)) AND (([ISBN] = ?) OR ([ISBN] IS NULL)) AND (([Title] = ?) OR ([Title] IS NULL)) AND (([author_Name] = ?) OR ([author_Name] IS NULL)) AND (([copy_No] = ?) OR ([copy_No] IS NULL)) AND (([checkOutStatus] = ?) OR ([checkOutStatus] IS NULL)) AND (([reserveStatus] = ?) OR ([reserveStatus] IS NULL)) AND (([reserveFrequency] = ?) OR ([reserveFrequency] IS NULL)) AND (([chekcOutFrequency] = ?) OR ([chekcOutFrequency] IS NULL))">
            <DeleteParameters>
                <asp:Parameter Name="original_book_ID" Type="Int32" />
                <asp:Parameter Name="original_ISBN" Type="String" />
                <asp:Parameter Name="original_Title" Type="String" />
                <asp:Parameter Name="original_author_Name" Type="String" />
                <asp:Parameter Name="original_copy_No" Type="Double" />
                <asp:Parameter Name="original_checkOutStatus" Type="Int32" />
                <asp:Parameter Name="original_reserveStatus" Type="Double" />
                <asp:Parameter Name="original_reserveFrequency" Type="String" />
                <asp:Parameter Name="original_chekcOutFrequency" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="ISBN" Type="String" />
                <asp:Parameter Name="Title" Type="String" />
                <asp:Parameter Name="author_Name" Type="String" />
                <asp:Parameter Name="copy_No" Type="Double" />
                <asp:Parameter Name="checkOutStatus" Type="Int32" />
                <asp:Parameter Name="reserveStatus" Type="Double" />
                <asp:Parameter Name="reserveFrequency" Type="String" />
                <asp:Parameter Name="chekcOutFrequency" Type="Int32" />
                <asp:Parameter Name="original_book_ID" Type="Int32" />
                <asp:Parameter Name="original_ISBN" Type="String" />
                <asp:Parameter Name="original_Title" Type="String" />
                <asp:Parameter Name="original_author_Name" Type="String" />
                <asp:Parameter Name="original_copy_No" Type="Double" />
                <asp:Parameter Name="original_checkOutStatus" Type="Int32" />
                <asp:Parameter Name="original_reserveStatus" Type="Double" />
                <asp:Parameter Name="original_reserveFrequency" Type="String" />
                <asp:Parameter Name="original_chekcOutFrequency" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="book_ID" Type="Int32" />
                <asp:Parameter Name="ISBN" Type="String" />
                <asp:Parameter Name="Title" Type="String" />
                <asp:Parameter Name="author_Name" Type="String" />
                <asp:Parameter Name="copy_No" Type="Double" />
                <asp:Parameter Name="checkOutStatus" Type="Int32" />
                <asp:Parameter Name="reserveStatus" Type="Double" />
                <asp:Parameter Name="reserveFrequency" Type="String" />
                <asp:Parameter Name="chekcOutFrequency" Type="Int32" />
            </InsertParameters>
        </asp:SqlDataSource>
        <br />
        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="Statistics.aspx">Statistics</asp:HyperLink>
</asp:Content>

